<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Shop extends Model
{
    public function __construct(array $attributes = [])
    {
        parent::__construct($attributes);
        dump($attributes, 'this is a shop model');
        
    }
    
    public function products()
    {
        return $this->belongsToMany(Product::class,'product_shop', 'shop_id', 'product_id')
//        ->withPivot('products_amount', 'price')
//        ->withTimestamps()
            ;
    }

    public function getNameIdAttribute()
    {
        return $this->id . '+' . $this->name;
    }
}
